#include "chipsinfo.h"

ChipsInfo::ChipsInfo()
{
}

QString ChipsInfo::revisionToStr(ChipsInfo::ChipGenerations generation, int revision)
{
    switch (generation)
    {
    case CG_Pak3:
        return revisionToStrGpd3(revision);

    case CG_Pak4:
        return revisionToStrGpd4(revision);

    default:
        return QString();
    }
}

QString ChipsInfo::revisionToStrGpd3(int revision)
{
    switch (revision)
    {
    case 1: return "SLG46720V";
    case 2: return "SLG46721V";
    case 3: return "SLG46722V";
    case 4: return "SLG46110V";
    case 5: return "SLG46120V";
    case 6: return "SLG46116V";
    case 7: return "SLG46117V";
    case 8: return "SLG46724V";
    default: return QString("Unknown");
    }
}

QString ChipsInfo::revisionToStrGpd4(int revision)
{
    switch (revision)
    {
    case 1: return "SLG46140V";
    case 2: return "SLG46620V";
    case 3: return "SLG46624V";
    case 4: return "SLG46624V SQAlwaysON";
    case 5: return "SLG4AP622V";
    default: return QString("Unknown");
    }
}

QList<QPair<QString, int> > ChipsInfo::revisionsList(ChipGenerations generation)
{
    QList<QPair<QString, int> > result;

    switch (generation) {
    case CG_Pak3:
        for (int i = 1; i < Gpak3GenerationChipsCount + 1; i++)
            result.append(QPair<QString, int>(revisionToStrGpd3(i), i));
        break;
    case CG_Pak4:
        for (int i = 1; i < Gpak4GenerationChipsCount + 1; i++)
            result.append(QPair<QString, int>(revisionToStrGpd3(i), i));
        break;
    default:
        break;
    }

    return result;
}
